/*
** func_for_parser.c for additional funcs in /home/ricard_v//rack/zappy
** 
** Made by vincent ricard
** Login   <ricard_v@epitech.net>
** 
** Started on  Sat Jul  2 19:38:55 2011 vincent ricard
** Last update Tue Jul  5 20:10:02 2011 vincent ricard
*/

#include	<unistd.h>
#include	<stdlib.h>
#include	<string.h>
#include	"parser.h"

void		aff_error(char *msg)
{
  write(STDERR_FILENO, msg, strlen(msg));
  exit(EXIT_FAILURE);
}

void            *xmalloc(size_t size)
{
  void          *status;
  int		retry;

  retry = 5;
  status = malloc(size);
  while (status == NULL && retry > 0)
    {
      status = malloc(size);
      retry--;
    }
  if (status == NULL)
    aff_error("Couldn't malloc after 5 attemps !\n");
  return (status);
}
